package com.token.sysflow.impl;

import com.token.base.JsonGenerator;
import com.token.sql.IntegrateSql;
import com.token.sql.PrepareSql;
import com.token.sysflow.bean.FSysFlowApproveLog;
import com.token.sysflow.enumerate.ActionTypeEnum;

import java.sql.ResultSet;

/**
 * @author chenjianxiong  2020/6/30
 */
public class GetFlowApproveLogImpl extends AbstractFlowHandlerImpl {

    @Override
    public void initParameter(IntegrateSql iSql) throws Exception {


        StringBuffer sql = new StringBuffer(100);
        sql.append("select * from ")
                .append(FSysFlowApproveLog.TABLE_NAME)
                .append(" where KeyUnid=?");
        PrepareSql pSql = new PrepareSql(iSql);
        pSql.setPrepare(sql);
        pSql.setPstValue(1,this.keyUnid);
        ResultSet rs = pSql.executeQuery();
        setReturnJson("data",JsonGenerator.toJsonArray(rs));
        rs.close();
    }

    @Override
    public ActionTypeEnum getActionType() {
        return ActionTypeEnum.FLOWAPPROVELOG;
    }

    @Override
    public void handleReturnResult() throws Exception {

    }
}
